package com.gang.mars.basic.generictype.demo8;

import javax.swing.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author：gang.chen
 * @Date：2023/6/13 13:59
 */
public class TestExample2 {

    public static void main(String[] args) {

        example2<String> example2 = new example2<>();

        String[] prizes = new String[]{"车子","房子","票子"};

        List<String> collect = Arrays.stream(prizes).collect(Collectors.toList());

        for (int i = 0; i < collect.size(); i++) {
            String s = collect.get(i);
            example2.addProduct(s);
        }

        String prize = example2.getRandomPrize();
        System.out.println(prize);
    }
}
